home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
borland
/
tpwn31.zip
/
PASCAL.ZIP
/
COMMDLG.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-04-06
|
12KB
|
355 lines
{*******************************************************}
{ }
{ Turbo Pascal for Windows Run-time Library }
{ Windows 3.1 API Interface Unit }
{ }
{ Copyright (c) 1992 Borland International }
{ }
{*******************************************************}
unit CommDlg;
interface
uses WinTypes;
type
POpenFilename = ^TOpenFilename;
TOpenFilename = record
lStructSize: Longint;
hWndOwner: HWnd;
hInstance: THandle;
lpstrFilter: PChar;
lpstrCustomFilter: PChar;
nMaxCustFilter: Longint;
nFilterIndex: Longint;
lpstrFile: PChar;
nMaxFile: Longint;
lpstrFileTitle: PChar;
nMaxFileTitle: Longint;
lpstrInitialDir: PChar;
lpstrTitle: PChar;
Flags: Longint;
nFileOffset: Word;
nFileExtension: Word;
lpstrDefExt: PChar;
lCustData: Longint;
lpfnHook: function (Wnd: HWnd; Msg, wParam: Word; lParam: Longint): Word;
lpTemplateName: PChar;
end;
function GetOpenFileName(var OpenFile: TOpenFilename): Bool;
function GetSaveFileName(var OpenFile: TOpenFilename): Bool;
function GetFileTitle(FileName, Title: PChar; TitleSize: Word): Integer;
const
ofn_ReadOnly = $00000001;
ofn_OverWritePrompt = $00000002;
ofn_HideReadOnly = $00000004;
ofn_NoChangeDir = $00000008;
ofn_ShowHelp = $00000010;
ofn_EnableHook = $00000020;
ofn_EnableTemplate = $00000040;
ofn_EnableTemplateHandle = $00000080;
ofn_NoValidate = $00000100;
ofn_AllowMultiSelect = $00000200;
ofn_ExtentionDifferent = $00000400;
ofn_PathMustExist = $00000800;
ofn_FileMustExist = $00001000;
ofn_CreatePrompt = $00002000;
ofn_ShareAware = $00004000;
ofn_NoReadOnlyReturn = $00008000;
ofn_NoTextFileCreate = $00010000;
{ Return values for the registered message sent to the hook function
when a sharing violation occurs. ofn_ShareFallThrough allows the
filename to be accepted, ofn_ShareNoWarn rejects the name but puts
up no warning (returned when the app has already put up a warning
message), and ofn_ShareWarn puts up the default warning message
for sharing violations.
Note: Undefined return values map to ofn_ShareWarn. }
ofn_ShareFallThrough = 2;
ofn_ShareNoWarn = 1;
ofn_ShareWarn = 0;
type
PChooseColor = ^TChooseColor;
TChooseColor = record
lStructSize: Longint;
hWndOwner: HWnd;
hInstance: HWnd;
rgbResult: Longint;
lpCustColors: PLongint;
Flags: Longint;
lCustData: Longint;
lpfnHook: function (Wnd: HWnd; Message, wParam: Word;
lParam: Longint): Word;
lpTemplateName: PChar;
end;
function ChooseColor(var CC: TChooseColor): Bool;
const
cc_RGBInit = $00000001;
cc_FullOpen = $00000002;
cc_PreventFullOpen = $00000004;
cc_ShowHelp = $00000008;
cc_EnableHook = $00000010;
cc_EnableTemplate = $00000020;
cc_EnableTemplateHandle = $00000040;
type
PFindReplace = ^TFindReplace;
TFindReplace = record
lStructSize: Longint; { size of this struct $20 }
hWndOwner: HWnd; { handle to owner's window }
hInstance: THandle; { instance handle of.EXE that
contains cust. dlg. template }
Flags: Longint; { one or more of the fr_?? }
lpstrFindWhat: PChar; { ptr. to search string }
lpstrReplaceWith: PChar; { ptr. to replace string }
wFindWhatLen: Word; { size of find buffer }
wReplaceWithLen: Word; { size of replace buffer }
lCustData: Longint; { data passed to hook fn. }
lpfnHook: function (Wnd: HWnd; Msg, wParam: Word; lParam: Longint): Word;
{ ptr. to hook fn. or nil }
lpTemplateName: PChar; { custom template name }
end;
const
fr_Down = $00000001;
fr_WholeWord = $00000002;
fr_MatchCase = $00000004;
fr_FindNext = $00000008;
fr_Replace = $00000010;
fr_ReplaceAll = $00000020;
fr_DialogTerm = $00000040;
fr_ShowHelp = $00000080;
fr_EnableHook = $00000100;
fr_EnableTemplate = $00000200;
fr_NoUpDown = $00000400;
fr_NoMatchCase = $00000800;
fr_NoWholeWord = $00001000;
fr_EnableTemplateHandle = $00002000;
fr_HideUpDown = $00004000;
fr_HideMatchCase = $00008000;
fr_HideWholeWord = $00010000;
function FindText(var FindReplace: TFindReplace): HWnd;
function ReplaceText(var FindReplace: TFindReplace): HWnd;
type
PChooseFont = ^TChooseFont;
TChooseFont = record
lStructSize: Longint; { }
hWndOwner: HWnd; { caller's window handle }
hDC: HDC; { printer DC/IC or nil }
lpLogFont: PLogFont; { ptr. to a LOGFONT struct }
iPointSize: Integer; { 10 * size in points of selected font }
Flags: Longint; { enum. type flags }
rgbColors: Longint; { returned text color }
lCustData: Longint; { data passed to hook fn. }
lpfnHook: function (Wnd: HWnd; Msg, wParam: Word; lParam: Longint): Word;
{ ptr. to hook function }
lpTemplateName: PChar; { custom template name }
hInstance: THandle; { instance handle of.EXE that
contains cust. dlg. template }
lpszStyle: PChar; { return the style field here
must be lf_FaceSize or bigger }
nFontType: Word; { same value reported to the EnumFonts
call back with the extra fonttype_
bits added }
nSizeMin: Integer; { minimum pt size allowed & }
nSizeMax: Integer; { max pt size allowed if
cf_LimitSize is used }
end;
function ChooseFont(var ChooseFond: TChooseFont): Bool;
const
cf_ScreenFonts = $00000001;
cf_PrinterFonts = $00000002;
cf_Both = cf_ScreenFonts or cf_PrinterFonts;
cf_ShowHelp = $00000004;
cf_EnableHook = $00000008;
cf_EnableTemplate = $00000010;
cf_EnableTemplateHandle = $00000020;
cf_InitToLogfontStruct = $00000040;
cf_UseStyle = $00000080;
cf_Effects = $00000100;
cf_Apply = $00000200;
cf_AnsiOnly = $00000400;
cf_NoVectorFonts = $00000800;
cf_NoOEMFonts = cf_NoVectorFonts;
cf_NoSimulations = $00001000;
cf_LimitSize = $00002000;
cf_FixedPitchOnly = $00004000;
cf_WYSIWYG = $00008000; { must also have cf_ScreenFonts & cf_PrinterFonts }
cf_ForceFontExist = $00010000;
cf_ScalableOnly = $00020000;
cf_TTOnly = $00040000;
cf_NoFaceSel = $00080000;
cf_NoStyleSel = $00100000;
cf_NoSizeSel = $00200000;
{ these are extra nFontType bits that are added to what is returned to the
EnumFonts callback routine }
Simulated_FontType = $8000;
Printer_FontType = $4000;
Screen_FontType = $2000;
Bold_FontType = $0100;
Italic_FontType = $0200;
Regular_FontType = $0400;
wm_ChooseFont_GetLogfont = wm_User + 1;
{ strings used to obtain unique window message for communication
between dialog and caller }
LBSelChString = 'commdlg_LBSelChangedNotify';
ShareViString = 'commdlg_ShareViolation';
FileOKString = 'commdlg_FileNameOK';
ColorOKString = 'commdlg_ColorOK';
SetRGBString = 'commdlg_SetRGBColor';
FindMsgString = 'commdlg_FindReplace';
HelpMsgString = 'commdlg_help';
{ HIWORD values for lParam of commdlg_LBSelChangeNotify message }
const
cd_LBSelNoItems = -1;
cd_LBSelChange = 0;
cd_LBSELSUB = 1;
cd_LBSelAdd = 2;
type
PPrintDlg = ^TPrintDlg;
TPrintDlg = record
lStructSize: Longint;
hWndOwner: HWnd;
hDevMode: THandle;
hDevNames: THandle;
hDC: HDC;
Flags: Longint;
nFromPage: Word;
nToPage: Word;
nMinPage: Word;
nMaxPage: Word;
nCopies: Word;
hInstance: THandle;
lCustData: L